# 在内部会维护一块区域存储 [1, 2, 10, 20,40 ] ,内存地址 1010101010
# def func(a1, a2=[1, 2]):
#     a2.append(a1)
#     print(id(a2))
#     return a2
#
# # a1=10
# # a2 -> 1010101010
# # v1 -> 1010101010
# v1=func(10)
# print(v1,id(v1))  # [1, 2, 10]
#
# # a1=20
# # a2 -> 1010101010
# # v2 -> 1010101010
# v2 = func(20)
# print(v2,id(v2))  # [1, 2, 10, 20 ]
#
# # a1=30
# # a2 -> 11111111111        [11, 22,30]
# # v3 -> 11111111111
# v3 = func(30, [11, 22])
# print(v3,id(v3))  # [11, 22,30]
#
# # a1=40
# # a2 -> 1010101010
# # v4 -> 1010101010
# v4 = func(40)
# print(v4,id(v4))   # [1, 2, 10, 20,40 ]



# # 内存中创建空间存储 [1, 2, 10, 20, 40] 地址：1010101010
# def func(a1, a2=[1, 2]):
#     a2.append(a1)
#     return a2
#
# # a1=10
# # a2 -> 1010101010
# # v1 -> 1010101010
# v1 = func(10)
#
# # a1=20
# # a2 -> 1010101010
# # v2 -> 1010101010
# v2 = func(20)
#
# # a1=30
# # a2 -> 11111111111   [11,22,30]
# # v3 -> 11111111111
# v3 = func(30, [11, 22])
#
# # a1=40
# # a2 -> 1010101010
# # v4 -> 1010101010
# v4 = func(40)
#
# print(v1) # [1, 2, 10, 20, 40]
# print(v2) # [1, 2, 10, 20, 40]
# print(v3) # [11,22,30]
# print(v4) # [1, 2, 10, 20, 40]

# 函数和函数名
# def add(a,b):
#     return a+b
# ret=add(1,2)
# print(ret)

# def func():
#     return 123
#
# data_list = ["小峰", "func", func , func() ]
#
# print(data_list[0]) # 字符串"小峰"
# print(data_list[1]) # 字符串 "func"
# print(data_list[2]) # 函数 func
# print(data_list[3]) # 整数 123
# res = data_list[2]()
# print(res) # 执行函数 func，并获取返回值；print再输出返回值。
# print(data_list[2]()) # 123

# 小峰
# func
# <function func at 0x0000029B0D49C310>
# 123
# 123
# 123

# def send_message():
#     """发送消息"""
#     pass
#
# def send_image():
#     """发送图片"""
#     pass
#
# def send_emoji():
#     """发送表情"""
#     pass
#
# def send_file():
#     """发送文件"""
#     pass
#
# print("欢迎使用xx系统")
# print("请选择：1.发送消息；2.发送图片；3.发送表情；4.发送文件")
# choice = input("输入选择的序号")
#
# if choice == "1":
#     send_message()
# elif choice == "2":
#     send_image()
# elif choice == "3":
#     send_emoji()
# elif choice == "4":
#     send_file()
# else:
#     print("输入错误")

def send_message():
    """发送消息"""
    pass
def send_image():
    """发送图片"""
    pass
def send_emoji():
    """发送表情"""
    pass
def send_file():
    """发送文件"""
    pass
def xxx():
    """收藏"""
    pass

function_dict = {
    "1": send_message,
    "2": send_image,
    "3": send_emoji,
    "4": send_file,
    "5": xxx
}

print("欢迎使用xx系统")
print("请选择：1.发送消息；2.发送图片；3.发送表情；4.发送文件")
choice = input("输入选择的序号:") # "1"

func = function_dict.get(choice)
if not func:
    print("输入错误")
else:
    # 执行函数
    func()

